//牛客
public class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String str1 = scanner.nextLine();
        String str2 = scanner.nextLine();
        char[] ch1 = str1.toUpperCase().toCharArray();
        char[] ch2 = str2.toUpperCase().toCharArray();
        HashSet<Character> set = new HashSet<>();
        for(int i = 0; i < ch2.length;i++){
            set.add(ch2[i]);
        }
        for (int i = 0; i < ch1.length; i++) {
            if(!set.contains(ch1[i])){
                System.out.print(ch1);
                set.add(ch1[i]);
            }
        }
    }
}